package com.maxmlr.nacosclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通过Feign实现接口调用
 *
 * @author maxiao
 * @create 2019/5/18
 * @since 1.0.0
 */
@RestController
public class TestFeignController {

    @Autowired
    Client client;

    @GetMapping("/test_feign")
    public String test() {
        String result = client.echo("test_feign");
        return "return : " + result;
    }

    @FeignClient("nacos-server")
    interface Client {

        @GetMapping("/echo/{string}")
        String echo(@PathVariable String string);

    }


}
